package com.aloha.springframework.aop.aspectj;

/**
 * @author DaiZhiHeng
 * @description 每次调用都创建新的
 * @date 2023/8/2 22:39
 */
public class PrototypeAspectInstanceFactory implements AspectInstanceFactory {

    private final Class<?> clazz;

    public PrototypeAspectInstanceFactory(Class<?> clazz) {
        this.clazz = clazz;
    }

    @Override
    public Object getAspectInstance() {
        try {
            return clazz.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            e.printStackTrace();
        }
        return null;
    }
}
